package com.hsylient.springboot.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringDocConfig {

    @Bean
    public GroupedOpenApi afterCreateRestApi() {
        return GroupedOpenApi.builder()
                .group("后台接口文档")
                .packagesToScan("com.hsylient.springboot")
                .build();
    }

    @Bean
    public GroupedOpenApi createRestApi() {
        return GroupedOpenApi.builder()
                .group("前台接口文档")
                .packagesToScan("com.hsylient.springboot")
                .build();
    }


    @Bean
    public OpenAPI springShopOpenApi() {
        return new OpenAPI()
                .info(new Info().title("springboot整合Swagger测试")
                        .description("做一个swagger接口文档的测试")
                        .version("v1.0.0")
                        .license(new License().name("使用请遵守AGPL3.0授权协议")));
    }
}
